//
//  headsView.m
//  HappyStore
//
//  Created by 李小辉 on 16/11/22.
//  Copyright © 2016年 LLJ. All rights reserved.
//

#import "headsView.h"

@implementation headsView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)initWithManyStr:(NSString *)manyStr HeadImageAry:(NSArray *)headImgAry{
    [self setFrame:CGRectMake(0, 0, screenW, 90)];
    self.backgroundColor = [UIColor whiteColor];
    UILabel *label = [[UILabel alloc] init];
    label.textColor = RGB(80, 80, 80);
    [label setFont:[UIFont systemFontOfSize:14]];
    label.text = [NSString stringWithFormat:@"%@%@",manyStr,@"人已报价"];
    CGSize size = [label sizeThatFits:CGSizeMake(MAXFLOAT, 17)];
    [label setFrame:CGRectMake(8, 8, size.width, size.height)];
    [self addSubview:label];
    
    for (int i = 0; i < headImgAry.count; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(8 + 50 * i, 35, 40, 40)];

        imageView.layer.cornerRadius = 20;
        imageView.backgroundColor = [UIColor whiteColor];
        imageView.layer.masksToBounds = YES;
        [imageView sd_setImageWithURL:[NSURL URLWithString:headImgAry[i][@"headPhoto"]]];
        [self addSubview:imageView];
        if ([headImgAry[i][@"authState"] integerValue] == 2) {
            UIImageView *imageAuth = [[UIImageView alloc] initWithFrame:CGRectMake(8 + 26 + 50 * i, 35 + 26, 14, 15)];
            [imageAuth setImage:[UIImage imageNamed:@"认证"]];
            [self addSubview:imageAuth];
        }
    }
    self.clickGoButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, screenW, 90)];
//    [self.clickGoButton setImage:[UIImage imageNamed:@"BackSingUp"] forState:UIControlStateNormal];
    self.clickGoButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    self.clickGoButton.contentEdgeInsets =  UIEdgeInsetsMake(15, 0, 0, 8);
    [self addSubview:self.clickGoButton];
}
@end

